﻿//Copyright (C) 2009  Jaco (ScionBot.com)

//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Scion.Library.Antiban
{
    /// <summary>
    /// Generates a random point.
    /// </summary>
    public class PointRandom
    {
        /// <summary>
        /// The random point generated by the PointRandom constructor.
        /// </summary>
        public Point random;
        /// <summary>
        /// The actual Y-Axis value.
        /// </summary>
        public int pointYValue;
        /// <summary>
        /// The actual X-Axis value.
        /// </summary>
        public int pointXValue;
        /// <summary>
        /// The maximum value of the random number appended.
        /// </summary>
        public int maximumValue;

        /// <summary>
        /// Generates a random point, negative or positive. The random point is then appended separately to
        /// the point.
        /// </summary>
        /// <param name="x">X-Axis of the point.</param>
        /// <param name="y">Y-Axis of the point.</param>
        /// <param name="maxValue">The maximum value of the random number appended.</param>
        public PointRandom(int x, int y, int maxValue)
        {
            pointXValue = x;
            pointYValue = y;
            maximumValue = maxValue;
            int r = new Random().Next(0, maxValue);
            System.Threading.Thread.Sleep(10);
            int r2 = new Random().Next(0, maxValue);
            int x2 = x + NPRandom.Determine(r);
            int y2 = y + NPRandom.Determine(r2);
            random = new Point(x2, y2);
        }
    }
}
